<script>
  import { createEventDispatcher } from 'svelte'

  // 创建事件分发器
  const dispatch = createEventDispatcher()

  function handleMessageBtn() {
    dispatch('message', {
      text: 'hello, i am message',
    })
  }

  function handleClickCC() {
    dispatch('gradesun-message', '我是孙子组件')
  }
</script>

<button on:click={handleMessageBtn}>message btn</button>
<button on:click={handleClickCC}>gradesun btn</button>
